package com.xyd.services.impl;

import com.xyd.dao.UserMapper;
import com.xyd.pojo.User;
import com.xyd.services.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("userService")
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> getAll() {
        return userMapper.getAll();
    }

    @Override
    public User login(User user) {
        return userMapper.searchUser(user);
    }

    @Override
    public User findByName(String nickName) {
       return userMapper.selectByNickName(nickName);
    }

    @Override
    public int addUser(User user) {
        return userMapper.insertUser(user);
    }
}
